package com.java.zhuiyun.api.userAchievement.controller;

import com.java.zhuiyun.annotation.OptLog;
import com.java.zhuiyun.common.response.CommonConstants;
import com.java.zhuiyun.common.response.CommonResult;
import com.java.zhuiyun.api.userAchievement.service.UserAchievementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName UserAchievementController
 * @Description TODO 用户成就管理
 * @Author WX
 * @Date 2023/10/16 13:51
 **/
@Api(tags = "用户成就管理")
@RestController
@CrossOrigin
@RequestMapping("/userAchievementController")
@Slf4j
public class UserAchievementController {
    @Autowired
    private UserAchievementService userAchievementService;

    /*
    * @Author WX
    * @Description 根据openid查询用户的成就信息
    * @Date 2023/10/16 14:07
    * @Return
    * @param openid
    */
    @RequestMapping ("/selectUserAchievement")
    @ApiOperation(value = "根据openid查询用户的成就信息")
    @OptLog(modular = "用户成就管理",type = CommonConstants.SELECT,describe = "根据openid查询用户的成就信息")
    public CommonResult selectUserAchievement (int uid){
        return CommonResult.ok(userAchievementService.selectUserAchievement(uid));
    }

    /*
    * @Author WX
    * @Description 领取奖励操作
    * @Date 2023/10/17 8:25
    * @Return
    * @param id
    */
    @RequestMapping("/claimRewardOperation")
    @ApiOperation(value = "领取奖励操作")
    @OptLog(modular = "用户成就管理",type = CommonConstants.UPDATE,describe = "领取奖励操作")
    public CommonResult claimRewardOperation (int id){
        return CommonResult.ok(userAchievementService.claimRewardOperation(id));
    }
}
